cmake_minimum_required(VERSION 3.10)
project(gl_demo)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(SFML_STATIC_LIBRARIES TRUE)
set(root ${CMAKE_CURRENT_LIST_DIR})
message("root: ${root}")

set(EXECUTABLE_OUTPUT_PATH  ${CMAKE_CURRENT_LIST_DIR}/bin)
set(CMAKE_PREFIX_PATH "${root}/third")

include_directories("${root}/include")
include_directories("${root}/third/glm/include")
include_directories("${root}/third/soil2/include")
# CONFIGURE_DEPENDS 标志会使构建系统检查目录变化，当检测到文件增减时自动重新运行 CMake
#file(GLOB srcs CONFIGURE_DEPENDS "${root}/src/*.c ${root}/src/*.cpp")
aux_source_directory("${root}/src" srcs)
message("srcs: ${srcs}")

add_compile_definitions("-DSFML_STATIC")
#add_definitions("-DSFML_SYSTEM_WINDOWS")
find_package(SFML COMPONENTS Graphics Window System REQUIRED)
find_package(glm REQUIRED)
find_package(soil2 REQUIRED)
find_package(OpenGL REQUIRED)

add_executable(${PROJECT_NAME} main.cpp ${srcs})
target_link_libraries(${PROJECT_NAME}
        SFML::Graphics
        SFML::Window SFML::System
        glm::glm opengl32 soil2::soil2
)
